package emumTest;

/**
 * @ClassName EnumTest4
 * @Description
 * 一种方式是使用构造器来初始化每个enm实例, 并以“一组”结果作为参数。这二者放在
 * 一块,形成了类似查询表的结构
 * @Author LIBOFEI
 * @Date 2020/6/7 14:18
 * @Version 1.0
 **/

interface Competitor<T extends Competitor<T>>{
    OutCome compete(T competitor);
}

enum RoShamBo3 {
    PAPER{
        @Override
        OutCome compete(RoShamBo3 it) {
            switch (it){
                default:
                case PAPER:
                    return OutCome.DRAW;
                case Rock:
                    return OutCome.WIN;
                case Scissor:
                    return OutCome.LOSE;
            }
        }
    },
    Scissor{
        @Override
        OutCome compete(RoShamBo3 it) {
            switch (it){
                default:
                case PAPER:
                    return OutCome.DRAW;
                case Rock:
                    return OutCome.WIN;
                case Scissor:
                    return OutCome.LOSE;
            }
        }
    },
    Rock{
        @Override
        OutCome compete(RoShamBo3 it) {
            switch (it){
                default:
                case PAPER:
                    return OutCome.DRAW;
                case Rock:
                    return OutCome.WIN;
                case Scissor:
                    return OutCome.LOSE;
            }
        }
    }
    ;

    abstract OutCome compete(RoShamBo3 it);
}

public class EnumTest4{

}

